package com.dongdongshop.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdongshop.data.Result;
import com.dongdongshop.pojo.content.TbContent;
import com.dongdongshop.service.content.ContentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("content")
public class ContentController {
    @Reference
    private ContentService contentService;
    private Logger logger = LoggerFactory.getLogger(ContentController.class);
    @RequestMapping("listSlideshow")
    @ResponseBody
    public Result listSlideshow(Long categoryId){
        try {
            List<TbContent> tbContentList = contentService.listSlideshow(categoryId);
            return Result.ok().setData(tbContentList);
        }catch (Exception e){
            logger.error("查询广告错误",e);
            return Result.fail();
        }
    }
}
